﻿namespace PageTypeBuilder.SortOrderChecker
{
    using System;
    using System.Reflection;

    public class Definition
    {
        public Type Type { get; set; }
        public object Attribute { get; set; }

        public string PageTypeName
        {
            get
            {
                PropertyInfo nameProperty = Attribute.GetType().GetProperty("Name", BindingFlags.Instance | BindingFlags.Public);

                if (nameProperty != null)
                    return (string)nameProperty.GetValue(Attribute, null);

                return string.Empty;
            }
        }

        public string TypeName
        {
            get { return Type.FullName; }
        }
    }
}